<?php
$best='This is truth:"php is the best language!"';"<br><br>" ;
echo $best,"<br>";
echo '$a是变量',"<br><br>";
/*(1)输出：This is truth:"php is the best language!"
(2)输出：$a是变量
*/


$money=1000;
$intrest1=0.025;
$intrest2=0.0279;
$total1=$money+$intrest1*$money;
$total2=$money+$intrest2*$money;
echo "第一年本息总和:$total1","<br>","第二年本息总和:$total2","<br><br>";
/*计算并输出银行存款1000元一年后及两年后的本息总额（假设一年息为2.25，两年息为2.79）*/



$pi=3.14;
$root="user";
echo "pi=",$pi,"<br>","root=",$root,"<br><br>";
/*.定义一些常量并输出，把3.14定义为pi，把root定义为user*/


$a=$_POST["a"];$b=$_POST["b"];$c=$_POST["c"];
 echo $a,"x2+",$b,"x+$c=0","<br>";
 $delta=pow($b,2)-4*$a*$c;
if($delta>=0){
    echo "x1 = ".((-$b+sqrt($delta))/(2*$a));
    echo "<br/>";
    echo "x2 = ".((-$b-sqrt($delta))/(2*$a));
}else echo "无解";
echo "<br><br>";

/*编写一个函数，用于求一元二次方程的根（根存入返回值）*/


$stu = array("no"=>"23333333","name"=>"ruby","sex"=>"女","tele"=>888888888);
print_r($stu);
echo "<br><br>";
/*遍历一个学生信息，包括学号、姓名、性别、电话，数组如下：
	$stu = array(“no”=>”23333333”,”name”=>”ruby”,”sex”=>”女”,”tele”=>888888888);*/
$woods=array(array("id"=>"001","name"=>"book","cost"=>"50"),array("id"=>"002","name"=>"bread","cost"=>"5"),array("id"=>"003","name"=>"bow1","cost"=>"10"));
print_r($woods);
echo "<br><br>";
/*遍历用户购物车数组中的商品编号、金额及价钱。数组内容如下：
	$woods=array(array(“id”=>”001”,”name”=>”book”,”cost”=>”50”),array(“id”=>”002”,”name”=>”bread”,”cost”=>”5”),array(“id”=>”003”,”name”=>”bow1”,”cost”=>”10”));*/




for($i=1;$i<10;$i++){
for($j=1;$j<=$i;$j++){
echo $j,'*',$i,'=',$i*$j,"<br>";
}}
echo "<br>";
/*打印阿拉伯数字九九乘法表*/



$truemoney=$_POST["truemoney"];$oughtmoney=$_POST["oughtmoney"];$charge=$truemoney-$oughtmoney;


$return100=$charge/100;
$return100_=floor($return100);
$return50=($charge-$return100_*100)/50;
$return50_=floor($return50);
$return20=($charge-$return100_*100-$return50_*50)/20;
$return20_=floor($return20);
$return10=($charge-$return100_*100-$return50_*50-$return20_*20)/10;
$return10_=floor($return10);
$return5=($charge-$return100_*100-$return50_*50-$return20_*20-$return10_*10)/5;
$return5_=floor($return5);
$return1=$charge%5;
echo "100的张数：",$return100_,"<br>",
	 "50的张数：",$return50_,"<br>",
	 "20的张数：",$return20_,"<br>",
	 "10的张数：",$return10_,"<br>",
	 "5的张数：",$return5_,"<br>",
	 "1的张数：",$return1,"<br>",
	 "<br><br>";
	 /*表单输入一个实收金额，一个应收金额，显示找零的各种纸币的张数，优先考虑面额大的纸币，显示各种人民币要多少张。现有1、5、10、20、50、100的面额。实收小于应收要报错。*/







$stud = array(0=>88,1=>60,3=>99,5=>66);
foreach ($stud as $key => $value) {
	echo $key."=>".$value."<br>";};
/*循环输出考生的编号和成绩*(第（1）（2）小问没看懂啊）*/





?>